<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('修改菌剂')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-projectMicrobial-edit"
			th:object="${projectMicrobial}">
			<input id="microbialId" name="microbialId" th:field="*{microbialId}" type="hidden">
      <div class="form-group">
        <label class="col-sm-3 control-label">菌剂类型：</label>
        <div class="col-sm-8">
          <div class="radio-box" th:each="dict : ${@dict.getType('micro_pharm_type')}">
            <input type="radio" th:id="${dict.dictCode}" name="microbialType" th:value="${dict.dictValue}" th:field="*{microbialType}">
            <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
          </div>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">种类：</label>
        <div class="col-sm-8">
          <select name="microbialCategory" class="form-control m-b" th:with="type=${@dict.getType('pharm_type')}" required>
            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{microbialCategory}"></option>
          </select>
          <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>菌剂类型选择种类“无”</span>
        </div>
      </div>
			<div class="form-group">
				<label class="col-sm-3 control-label">菌剂名称：</label>
				<div class="col-sm-8">
					<input id="microbialName" name="microbialName"
						th:field="*{microbialName}" class="form-control" type="text" maxlength="30" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">菌剂价格（元）：</label>
				<div class="col-sm-8">
					<input id="microbialPrice" name="microbialPrice"
						th:field="*{microbialPrice}" class="form-control" type="text" maxlength="8" required>
				</div>
			</div>
      <div class="form-group">
        <label class="col-sm-3 control-label">产品规格：</label>
        <div class="col-sm-8">
          <input name="microbialSpec" th:field="*{microbialSpec}" class="form-control" type="text" maxlength="100">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">产品单位：</label>
        <div class="col-sm-8">
          <select name="microbialUnit" class="form-control m-b" th:with="type=${@dict.getType('micro_unit_type')}">
            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{microbialUnit}"></option>
          </select>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">产品logo图片：</label>
        <div class="col-sm-5">
          <input name="logoFile" type="file" accept="image/*">
        </div>
        <div class="col-sm-1">
          <div th:if="${projectMicrobial.microbialLogoUrl != null and projectMicrobial.microbialLogoUrl != ''}">
            <img class='img-circle img-xs' data-target='self' th:src="'/abvfile/micro/'+${projectMicrobial.microbialLogoUrl}">
          </div>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">产品介绍图片：</label>
        <div class="col-sm-5">
          <input name="file" type="file" accept="image/*">
        </div>
        <div class="col-sm-1">
          <div th:if="${projectMicrobial.microbialUrl != null and projectMicrobial.microbialUrl != ''}">
            <img class='img-circle img-xs' data-target='blank' th:src="'/abvfile/micro/'+${projectMicrobial.microbialUrl}">
          </div>
        </div>
      </div>
		</form>
	</div>
  <th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "project/projectMicrobial";
		$("#form-projectMicrobial-edit").validate({
			rules : {
				microbialPrice : {
          number : true
				}
			},
			focusCleanup : true
		});

		function submitHandler() {
			if ($.validate.form()) {
        var formData = new FormData($("#form-projectMicrobial-edit")[0]);
        $.ajax({
          url: prefix + "/edit",
          type: "post",
          data: formData,
          cache: false,
          processData: false,
          contentType: false,
          success: function(result) {
            $.operate.saveSuccess(result);
          }
        });
			}
		}

		$.form.imgView("#form-projectMicrobial-edit");
	</script>
</body>
</html>
